using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class RoleMap : EntityTypeConfiguration<Role>
	{
		public RoleMap()
		{
			// Primary Key
			this.HasKey(t => t.RoleID);

			// Properties
			this.Property(t => t.RoleName)
				.HasMaxLength(50);
				
			this.Property(t => t.RoleComment)
				.HasMaxLength(50);
				
			// Table & Column Mappings
			this.ToTable("Role");
			this.Property(t => t.RoleID).HasColumnName("RoleID");
			this.Property(t => t.RoleType).HasColumnName("RoleType");
			this.Property(t => t.RoleName).HasColumnName("RoleName");
			this.Property(t => t.RoleComment).HasColumnName("RoleComment");
			this.Property(t => t.Sorting).HasColumnName("Sorting");
			this.Property(t => t.IsDeleted).HasColumnName("IsDeleted");
			this.Property(t => t.CreatBy).HasColumnName("CreatBy");
			this.Property(t => t.CreatStation).HasColumnName("CreatStation");
			this.Property(t => t.CteatTime).HasColumnName("CteatTime");
			this.Property(t => t.UpdateBy).HasColumnName("UpdateBy");
			this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
			this.Property(t => t.UpdateStation).HasColumnName("UpdateStation");
		}
	}
}

